package cn.hp.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.hp.domain.Permission;
import cn.hp.mapper.PermissionMapper;
import cn.hp.service.PermissionService;
@Service
@Transactional
public class PermissionServiceImpl implements PermissionService{
	
	@Autowired
	private PermissionMapper permissionMapper;
	@Override
	public List<String> findPermissionsByUserId(Integer userid) {
		
		List<Permission> permissions=permissionMapper.findPermissionsByUserId(userid);
		List<String> permissionList=new ArrayList<>();
		for (Permission permission : permissions) {
			permissionList.add(permission.getPercode());
		}
		
		return permissionList;
	}

}
